package com.kasax.imgloader.demo.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.kasax.imgloader.demo.utils.ImageUtils;
import com.kasax.imgloader.demo.R;

class MyViewHodler extends RecyclerView.ViewHolder {
    public TextView tvAuthor;
    public TextView tvName;
    public TextView tvLisense;
    public TextView tvDesc;
    public ImageView ivCover;

    public MyViewHodler(@NonNull View itemView) {
        super(itemView);

        tvAuthor = itemView.findViewById(R.id.tv_author);
        tvName = itemView.findViewById(R.id.tv_name);
        tvLisense = itemView.findViewById(R.id.tv_lisense);
        tvDesc = itemView.findViewById(R.id.tv_desc);
        ivCover = itemView.findViewById(R.id.iv_cover);
    }

    public void setAuthor(String title) {
        tvAuthor.setText(title);
    }

    public void setName(String title) {
        tvName.setText(title);
    }

    public void setDesc(String title) {
        tvDesc.setText(title);
    }

    public void setLisense(String title) {
        tvLisense.setText(title);
    }

    public void setImage(String url) {
        ImageUtils.loadCircleImageWithGlide(ivCover, url);
    }

    public void setImageLoader(String url) {
        ImageUtils.loadCircleImageWithImgLoader(ivCover, url);
    }
}